package com.taiyuan.ty.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.taiyuan.ty.entity.Place;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper

public interface PlaceMapper extends BaseMapper<Place> {
    @Update("UPDATE places SET like_count = like_count + #{delta} WHERE id = #{placeId}")
    void incrementLikeCount(@Param("placeId") Long placeId, @Param("delta") int delta);

    @Update("UPDATE places SET favorite_count = favorite_count + #{delta1} WHERE id = #{placeId}")
    void incrementFavoriteCount(@Param("placeId") Long placeId,@Param("delta1") int delta1);
}